/***
 *翻页功能
 */
//得到无参数的URL
function getUrlNoParam(url)
{
	if(!url||url.length==0)
	{
		return "";
	}
	var idx=url.indexOf('?');
	if(idx==-1)
	{
		return url;
	}
	var gotoUrl = url.substring(0,idx);
	if(url.indexOf("#")!=-1){
		gotoUrl = gotoUrl + url.substr(url.indexOf("#"));
	}
	return gotoUrl;
}

//得到URL的参数对
function getUrlParams(url)
{
	var params=new Array();
	if(!url||url.length==0)
	{
		return params;
	}
	var idx=url.indexOf('?');
	if(idx==-1)
	{
		return params;
	}
	url=url.substr(idx+1);
	var nameValues=url.split('&');
	for(var i=0;i<nameValues.length;i++)
	{
		var nameValue=nameValues[i];
		if(nameValue&&nameValue.length>0)
		{
			var idxEq=nameValue.indexOf('=');
			if(idxEq>-1)
			{
				var textValue = nameValue.substr(idxEq+1);
				if(textValue.indexOf("#")!=-1){
					textValue = textValue.substr(0,textValue.indexOf("#"));
				}
				params.push({name:nameValue.substr(0,idxEq),value:textValue});
			}
		}
	}
	return params;
}

//将URLGET请求转化为POST请求
function fGotoPage(url)
{
	var oForm=document.createElement("FORM");
	oForm.setAttribute("action",getUrlNoParam(url));
	oForm.setAttribute("method","get");
	var params=getUrlParams(url);
	for(var i=0;i<params.length;i++)
	{
		var oInput=document.createElement("INPUT");
		oInput.setAttribute("type","hidden");
		oInput.setAttribute("name",params[i].name);
		oInput.setAttribute("value",params[i].value);
		oForm.appendChild(oInput);
	}
	document.body.appendChild(oForm);
	oForm.submit();
}

/**
 * 请求参数封装在url中,并不通过request的parameter传值,而是把参数作为地址内容
 * @param url
 * 
 */
function fGotoPageByUrlSplitParam(url)
{
	var oForm=document.createElement("FORM");
	oForm.setAttribute("action",url);
	oForm.setAttribute("method","post");
	document.body.appendChild(oForm);
	oForm.submit();
}